import $ from '../common';
Page({
  data: {
    tit:'load',
    countdown: 30,

  },
  onLoad(e) {
    wx.setNavigationBarTitle({
      title: '等待支付结果',
    })
    let countdown = this.data.countdown
    let _fn = () => {
      if (countdown == 0) {
        console.log(this.setTimeDentify);
        this.resetDentify()
      } else {
        this.setData({
          countdown: countdown,
        })
        // if (countdown == 29) {
        //   this.getIdentify(JSON.parse(e.obj))
        // }
        countdown--
      }
    }
    _fn()
    this.setTimeDentify = setInterval(() => {
      _fn()
    }, 1000)
  },
  onShow() {},
  resetDentify() { //倒计时到期时
    clearInterval(this.setTimeDentify)
    this.setData({
      countdown: 0,
    })
  },
  getIdentify(obj) {//请求
    clearInterval(this.setTimeDentify)
    // $.post('/teacher/sign/add', obj, res => {
    //   const {teachersign=''}=res
    //   this.setData({
    //     tit:'签到结果',
    //     teachersign
    //   })
    // }, fail => {
    //   const {status='',data=''}=fail
    //   this.setData({
    //     tit:'签到结果',
    //     status,
    //     date:data,
    //   })
    // })
  },
})